Domain specific language for encoding assistant dialog

ABSTRACT

Systems and processes for generating output dialogs for virtual assistants are provided. An output dialog can be generated from multiple output segments that can each include a string of one or more characters or words. The contents of an output segment can be selected from multiple possible outputs based on a predetermined order, conditional logic, or a random selection. The output segments can be concatenated to form the output dialog. In one example, a dialog generation file that defines the possible outputs for each output segment, an ordering of the output segments within the output dialog, and format for the output dialog can be used to generate the output dialog. The dialog generation file can include any number of functional blocks, which can each output an output segment, that can be arranged hierarchically and in a particular order to generate a desired output dialog.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority from U.S. Provisional Ser. No. 62/005,886, filed on May 30, 2014, entitled DOMAIN SPECIFIC LANGUAGE FOR ENCODING ASSISTANT DIALOG, which is hereby incorporated by reference in its entirety for all purposes.

FIELD

This relates generally to virtual assistants and, more specifically, to generating output dialogs for virtual assistants.

BACKGROUND

Intelligent automated assistants (or virtual assistants) provide an intuitive interface between users and electronic devices. These assistants can allow users to interact with devices or systems using natural language in spoken and/or text forms. For example, a user can access the services of an electronic device by providing a spoken user input in natural language form to a virtual assistant associated with the electronic device. The virtual assistant can perform natural language processing on the spoken user input to infer the user's intent and operationalize the user's intent into tasks. The tasks can then be performed by executing one or more functions of the electronic device, and a relevant output can be returned to the user in natural language form.

To generate the output in natural language form, conventional virtual assistants require that a developer specify the content and format of every possible natural language output (e.g., in full-sentence form), as well as the specific conditions that must be met for each output to be returned to the user. For example, a virtual assistant can be programmed to output the string “Your search returned <results.number> results” in response to a search query yielding multiple results, can be programmed to output the string “Your search returned one result” in response to a search query yielding one result, and can be programmed to output the string “Your search returned no results” in response to a search query yielding no results.

While conventional virtual assistants programmed in this way can produce relevant outputs in natural language form, the process of specifying the content and format of every possible natural language output can be time-consuming and can produce repetitive results.

SUMMARY

Systems and processes for operating a virtual assistant are disclosed. One example process can include accessing a textual representation of user speech, determining a response to the textual representation of user speech, generating a plurality of output segments based on the determined response to the textual representation of user speech, wherein each of the plurality of output segments comprises one or more words, and generating an output dialog based on the plurality of output segments and an order associated with the plurality of output segments.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an exemplary environment in which a virtual assistant can operate according to various examples.

FIG. 2 illustrates an exemplary user device according to various examples.

FIG. 3 illustrates a visual representation of an example dialog generation file that can be used to generate an output dialog of a virtual assistant according to various examples.

FIG. 4 illustrates a visual representation of an example output generation file and the output dialog that can be generated using the output generation file.

FIG. 5 illustrates an exemplary process for generating an output dialog for a virtual assistant according to various examples.

FIG. 6 illustrates an example conversation interface that can be displayed on a user device according to various examples.

FIG. 7 illustrates a functional block diagram of an electronic device configured to generate an output dialog for a virtual assistant according to various examples.

DETAILED DESCRIPTION

In the following description of examples, reference is made to the accompanying drawings in which it is shown by way of illustration specific examples that can be practiced. It is to be understood that other examples can be used and structural changes can be made without departing from the scope of the various examples.

For descriptive purposes, throughout this disclosure, software, software modules, software blocks, software objects, and the like may be described as performing various functions. One of ordinary skill in the art, however, will recognize that software may not actively perform any function and instead may include instructions that are executable on a computer processor. As such, although software may be described herein as performing a function, it should be appreciated that a computer processor or other computing device may typically perform those functions attributed herein to software modules, blocks, or objects by executing computer instructions provided by the software modules, blocks, or objects.

This relates to systems and processes for generating output dialogs for virtual assistants. An output dialog can be generated from multiple output segments that can each include a string of one or more characters or words. The contents of an output segment can be selected from multiple possible outputs based on a predetermined order, conditional logic, or a random selection. The output segments can then be concatenated to form the output dialog. In some examples, a dialog generation file that defines the possible outputs for each output segment, an ordering of the output segments within the output dialog, and format for the output dialog to be displayed or otherwise presented to a user can be used to generate the output dialog. The dialog generation file can include any number of functional blocks, which can each output an output segment, that can be arranged hierarchically and in a particular order to generate a desired output dialog.

System Overview

FIG. 1 illustrates exemplary system 100 for implementing a virtual assistant according to various examples. The terms “virtual assistant,” “digital assistant,” “intelligent automated assistant,” or “automatic digital assistant” can refer to any information processing system that interprets natural language input in spoken and/or textual form to infer user intent, and performs actions based on the inferred user intent. For example, to act on an inferred user intent, the system can perform one or more of the following: identifying a task flow with steps and parameters designed to accomplish the inferred user intent; inputting specific requirements from the inferred user intent into the task flow; executing the task flow by invoking programs, methods, services, APIs, or the like; and generating output responses to the user in an audible (e.g., speech) and/or visual form.

A virtual assistant can be capable of accepting a user request at least partially in the form of a natural language command, request, statement, narrative, and/or inquiry. Typically, the user request seeks either an informational answer or performance of a task by the virtual assistant. A satisfactory response to the user request can include provision of the requested informational answer, performance of the requested task, or a combination of the two. For example, a user can ask the virtual assistant a question, such as “Where am I right now?” Based on the user's current location, the virtual assistant can answer, “You are in Central Park.” The user can also request the performance of a task, for example, “Please remind me to call Mom at 4 p.m. today.” In response, the virtual assistant can acknowledge the request and then create an appropriate reminder item in the user's electronic schedule. During the performance of a requested task, the virtual assistant can sometimes interact with the user in a continuous dialogue involving multiple exchanges of information over an extended period of time. There are numerous other ways of interacting with a virtual assistant to request information or performance of various tasks. In addition to providing verbal responses and taking programmed actions, the virtual assistant can also provide responses in other visual or audio forms (e.g., as text, alerts, music, videos, animations, etc.).

An example of a virtual assistant is described in Applicants' U.S. Utility application Ser. No. 12/987,982 for “Intelligent Automated Assistant,” filed Jan. 10, 2011, the entire disclosure of which is incorporated herein by reference.

As shown in FIG. 1, in some examples, a virtual assistant can be implemented according to a client-server model. The virtual assistant can include a client-side portion executed on a user device 102, and a server-side portion executed on a server system 110. User device 102 can include any electronic device, such as a mobile phone, tablet computer, portable media player, desktop computer, laptop computer, PDA, television, television set-top box, wearable electronic device, or the like, and can communicate with server system 110 through one or more networks 108, which can include the Internet, an intranet, or any other wired or wireless public or private network. The client-side portion executed on user device 102 can provide client-side functionalities, such as user-facing input and output processing and communications with server system 110. Server system 110 can provide server-side functionalities for any number of clients residing on a respective user device 102.

Server system 110 can include one or more virtual assistant servers 114 that can include a client-facing I/O interface 122, one or more processing modules 118, data and model storage 120, and an I/O interface to external services 116. The client-facing I/O interface 122 can facilitate the client-facing input and output processing for virtual assistant server 114. The one or more processing modules 118 can utilize data and model storage 120 to determine the user's intent based on natural language input, and perform task execution based on inferred user intent. In some examples, virtual assistant server 114 can communicate with external services 124, such as telephony services, calendar services, information services, messaging services, navigation services, and the like, through network(s) 108 for task completion or information acquisition. The I/O interface to external services 116 can facilitate such communications.

Server system 110 can be implemented on one or more standalone data processing devices or a distributed network of computers. In some examples, server system 110 can employ various virtual devices and/or services of third-party service providers (e.g., third-party cloud service providers) to provide the underlying computing resources and/or infrastructure resources of server system 110.

Although the functionality of the virtual assistant is shown in FIG. 1 as including both a client-side portion and a server-side portion, in some examples, the functions of the assistant can be implemented as a standalone application installed on a user device. In addition, the division of functionalities between the client and server portions of the virtual assistant can vary in different examples. For instance, in some examples, the client executed on user device 102 can be a thin-client that provides only user-facing input and output processing functions, and delegates all other functionalities of the virtual assistant to a backend server.

User Device

FIG. 2 is a block diagram of a user device 102 according to various examples. As shown, user device 102 can include a memory interface 202, one or more processors 204, and a peripherals interface 206. The various components in user device 102 can be coupled together by one or more communication buses or signal lines. User device 102 can further include various sensors, subsystems, and peripheral devices that are coupled to the peripherals interface 206. The sensors, subsystems, and peripheral devices gather information and/or facilitate various functionalities of user device 102.

For example, user device 102 can include a motion sensor 210, a light sensor 212, and a proximity sensor 214 coupled to peripherals interface 206 to facilitate orientation, light, and proximity sensing functions. One or more other sensors 216, such as a positioning system (e.g., a GPS receiver), a temperature sensor, a biometric sensor, a gyroscope, a compass, an accelerometer, and the like, are also connected to peripherals interface 206, to facilitate related functionalities.

In some examples, a camera subsystem 220 and an optical sensor 222 can be utilized to facilitate camera functions, such as taking photographs and recording video clips. Communication functions can be facilitated through one or more wired and/or wireless communication subsystems 224, which can include various communication ports, radio frequency receivers and transmitters, and/or optical (e.g., infrared) receivers and transmitters. An audio subsystem 226 can be coupled to speakers 228 and a microphone 230 to facilitate voice-enabled functions, such as voice recognition, voice replication, digital recording, and telephony functions.

In some examples, user device 102 can further include an I/O subsystem 240 coupled to peripherals interface 206. I/O subsystem 240 can include a touch screen controller 242 and/or other input controller(s) 244. Touch-screen controller 242 can be coupled to a touch screen 246. Touch screen 246 and the touch screen controller 242 can, for example, detect contact and movement or break thereof using any of a plurality of touch sensitivity technologies, such as capacitive, resistive, infrared, and surface acoustic wave technologies, proximity sensor arrays, and the like. Other input controller(s) 244 can be coupled to other input/control devices 248, such as one or more buttons, rocker switches, a thumb-wheel, an infrared port, a USB port, and/or a pointer device such as a stylus.

In some examples, user device 102 can further include a memory interface 202 coupled to memory 250. Memory 250 can include any electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, a portable computer diskette (magnetic), a random access memory (RAM) (magnetic), a read-only memory (ROM) (magnetic), an erasable programmable read-only memory (EPROM) (magnetic), a portable optical disc such as CD, CD-R, CD-RW, DVD, DVD-R, or DVD-RW, or flash memory such as compact flash cards, secured digital cards, USB memory devices, memory sticks, and the like. In some examples, a non-transitory computer-readable storage medium of memory 250 can be used to store instructions (e.g., for performing some or all of process 500, described below) for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device, and execute the instructions. In other examples, the instructions (e.g., for performing process 500, described below) can be stored on a non-transitory computer-readable storage medium of server system 110, or can be divided between the non-transitory computer-readable storage medium of memory 250 and the non-transitory computer-readable storage medium of server system 110. In the context of this document, a “non-transitory computer readable storage medium” can be any medium that can contain or store the program for use by or in connection with the instruction execution system, apparatus, or device.

In some examples, the memory 250 can store an operating system 252, a communication module 254, a graphical user interface module 256, a sensor processing module 258, a phone module 260, and applications 262. Operating system 252 can include instructions for handling basic system services and for performing hardware-dependent tasks. Communication module 254 can facilitate communicating with one or more additional devices, one or more computers, and/or one or more servers. Graphical user interface module 256 can facilitate graphic user interface processing. Sensor processing module 258 can facilitate sensor-related processing and functions. Phone module 260 can facilitate phone-related processes and functions. Application module 262 can facilitate various functionalities of user applications, such as electronic messaging, web browsing, media processing, navigation, imaging, and/or other processes and functions.

As described herein, memory 250 can also store client-side virtual assistant instructions (e.g., in a virtual assistant client module 264) and various user data 266 (e.g., user-specific vocabulary data, preference data, and/or other data, such as the user's electronic address book, to-do lists, shopping lists, etc.) to provide the client-side functionalities of the virtual assistant.

In various examples, virtual assistant client module 264 can be capable of accepting voice input (e.g., speech input), text input, touch input, and/or gestural input through various user interfaces (e.g., I/O subsystem 240, audio subsystem 226, or the like) of user device 102. Virtual assistant client module 264 can also be capable of providing output in audio (e.g., speech output), visual, and/or tactile forms. For example, output can be provided as voice, sound, alerts, text messages, menus, graphics, videos, animations, vibrations, and/or combinations of two or more of the above. During operation, virtual assistant client module 264 can communicate with the virtual assistant server using communication subsystem 224.

In some examples, virtual assistant client module 264 can utilize the various sensors, subsystems, and peripheral devices to gather additional information from the surrounding environment of user device 102 to establish a context associated with a user, the current user interaction, and/or the current user input. In some examples, virtual assistant client module 264 can provide the contextual information or a subset thereof with the user input to the virtual assistant server to help infer the user's intent. The virtual assistant can also use the contextual information to determine how to prepare and deliver outputs to the user.

In some examples, the contextual information that accompanies the user input can include sensor information, such as lighting, ambient noise, ambient temperature, images or videos of the surrounding environment, distance to another object, and the like. The contextual information can further include information associated with the physical state of user device 102 (e.g., device orientation, device location, device temperature, power level, speed, acceleration, motion patterns, cellular signal strength, etc.) or the software state of user device 102 (e.g., running processes, installed programs, past and present network activities, background services, error logs, resources usage, etc.). Any of these types of contextual information can be provided to the virtual assistant server 114 as contextual information associated with a user input.

In some examples, virtual assistant client module 264 can selectively provide information (e.g., user data 266) stored on user device 102 in response to requests from the virtual assistant server 114. Virtual assistant client module 264 can also elicit additional input from the user via a natural language dialogue or other user interfaces upon request by virtual assistant server 114. Virtual assistant client module 264 can pass the additional input to virtual assistant server 114 to help virtual assistant server 114 in intent inference and/or fulfillment of the user's intent expressed in the user request.

In various examples, memory 250 can include additional instructions or fewer instructions. Furthermore, various functions of user device 102 can be implemented in hardware and/or in firmware, including in one or more signal processing and/or application-specific integrated circuits.

Output Dialog Encoding

As mentioned above, system 100 can be used to implement a virtual assistant capable of interpreting natural language input in spoken and/or textual form to infer user intent, and performing actions based on the inferred user intent. In some examples, the performed actions can include generating and outputting an output dialog in text and/or audio form. For example, in response to the query “What is the temperature in New York?”, a virtual assistant implemented on a user device can display the text “The temperature in New York is 72° F.” In order for the virtual assistant to produce this output dialog in natural language form, instructions that define the contents and format of the dialog can be provided to the virtual assistant. FIG. 3 shows a visual representation of a dialog generation file 300 that can be used to provide a virtual assistant with such information.

Generally, dialog generation file 300 can be used to generate an output dialog (e.g., “Good morning, John.”) by defining multiple output segments that represent a portion of the output dialog (e.g., a first output segment “Good morning,” and a second output segment “John.”). Dialog generation file 300 can further define the possible outputs that can be used in each output segment (e.g., “Good morning,” “Good afternoon,” or “Good evening,” for the first output segment), how to select one of the possible output segments, and how to format the output segments to generate the output dialog. As discussed in greater detail below, dialog generation file 300 can define these parameters for generating the output dialog using various types of functional blocks 302-310 arranged hierarchically and/or in a particular order to generate a desired output dialog.

As shown in FIG. 3, dialog generation file 300 can include multiple types of functional blocks 302-310 that can output or return an output segment of text. An output segment of text can include a string of one or more characters or words and can be ordered amongst the other output segments of text based on an ordering of the functional blocks within dialog generation file 300. In some examples, the output dialog can be generated by concatenating the output segments of text based on the order of the output segments. For example, if dialog generation file 300 includes random block 305 outputting the output segment of text “Hi,” followed by text block 302 outputting the output segment of text “how are you doing?”, the output dialog generated from dialog generation file 300 can include the text “Hi, how are you doing?”.

Dialog generation file 300 can include any number of and type of functional blocks. In some examples, the functional blocks can be arranged in a hierarchy such that one functional block (e.g., the child functional block) is included within another functional block (e.g., the parent functional block). In these examples, the output segment of text output by the child functional block can be returned as an input to the parent functional block and used by the parent functional block in a manner that depends on a type of the parent functional block (e.g., a type corresponding to blocks 302-310, described below). In some examples, a functional block can include any number of other functional blocks. Additionally, the hierarchy formed by the nested functional blocks can include any number of levels. For example, a first functional block can be included within a second functional block, which can be included within a third functional block, and so on.

One type of functional block that can be included in dialog generation file 300 is text block 302. Text block 302 can be configured to include desired text represented as a predetermined string of characters or words, such as “Good morning,” and/or a variable representing a number or a string of characters or words, such as <name> having a value of “John.” The formatting of the predetermined string of characters or words with a variable (e.g., “Good morning,”<name>) can be referred to as a “template.” When executed, text block 302 can be configured to output the included text as an output segment of text. For example, a text block 302 that includes the text “Okay, here are your search results:” can output that text as an output segment of text when executed.

Dialog generation file 300 can further include first block 303, which can be configured to include an ordered list of one or more options (e.g., Option 1, Option 2, and Option 3). Each option can include one or more of the functional blocks shown in FIG. 3. When executed, first block 303 can select the first option (Option 1) from the ordered list and can call the functional block associated with that option. First block 303 can then output the text received from the called functional block (e.g., the output segment produced by the called functional block) as an output segment of text. If the selection of the first option is successful (e.g., successfully calls another functional block), the operation of first block 303 can end. However, if the selection of the first option fails, first block 303 can then attempt to select the next option from the ordered list (Option 2). This process can repeat for all options in the ordered list until an option is successfully selected. In the event that no option is successfully selected, first block 303 can return an error. While first block 303 is shown having three options, it should be appreciated that first block 303 can include any number of options.

To illustrate the operation of first block 303, Option 1 of first block 303 can include a text block 302 that includes the text “Hello,” Option 2 of first block 303 can include a text block 302 that includes the text “Hi,” and Option 3 of first block 303 can include switch block 304 (described below). Upon execution, first block 303 can first attempt to call the first text block 302 and output the text “Hello” returned by the first text block 302 as an output segment of text. If successful, the operation of block 303 can end. However, if unable to output the text “Hello” as an output segment of text for any reason, first block 303 can then attempt to call the second text block 302 and output the text “Hi” returned by the second text block 302 as an output segment of text. If successful, the operation of block 303 can end. However, if unable to output the text “Hi” as an output segment of text for any reason, first block 303 can then attempt to call switch block 304. If switch block 304 is successfully executed and returns a text output, first block 303 can output the text returned from switch block 304 as an output segment of text and the operation of block 303 can end. However, if unable to successfully call switch block 304 for any reason, first block 303 can return an error because it reached the end of its ordered list without successfully selecting one of the three options.

Dialog generation file 300 can further include switch block 304, which can be configured to include an input parameter (e.g., <parameter>) and a list of one or more choices (e.g., Option 1, Option 2, and Option 3) that are associated with potential values of the input parameter (e.g., <A> and <B>) or a default condition (e.g., Default). Each option can include one of the functional blocks shown in FIG. 3. When executed, switch block 304 can select one of the options based on the value of the input parameter matching an associated value of one of the options and can call the functional block associated with that option. Switch block 304 can then output the text received from the called functional block (e.g., the output segment produced by the called functional block) as an output segment of text. For example, switch block 304 can select Option 1 if the value of <parameter> is equal to the value of <A>, can select Option 2 if the value of <parameter> is equal to the value of <B>, and can select Option 3 if the value of <parameter> is not equal to the values of <A> or <B>. While switch block 304 is shown as having three options, it should be appreciated that switch block 304 can include any number of options.

In some examples, <parameter> can include any desired variable representing information that is to be presented to the user (e.g., search query results, etc.) or contextual information, such as sensor information, information associated with the physical state of a user device, information associated with a software state of the user device, or the like. For example, the contextual information can include a type of user device used to operate the virtual assistant, an operational state of the user device, a current time, a location of the user device, an orientation of the user device, or an orientation of a user with respect to the user device.

To illustrate the operation of switch block 304, <parameter> of switch block 304 can represent a number of results generated from a search query, <A> can represent the value 0, Option 1 of switch block 304 can include a text block 302 that includes the text “Your search produced no results,”<B> can represent the value 1, Option 2 of switch block 304 can include a text block 302 that includes the text “Your search produced 1 result,” and Option 3 of switch block 304 can include a text block 302 that includes the text “Your search produced multiple results.” In this example, switch block 304 can call the first text block 302 and output the text “Your search produced no results” returned by the first text block 302 as an output segment of text if the number of results generated from the search query is 0 (<parameter>==0), can call the second text block 302 and output the text “Your search produced 1 result” returned by the second text block 302 as an output segment of text if the number of results generated from the search query is 1 (<parameter>==1), and can call the third text block 302 and output the text “Your search produced no results” returned by the third text block 302 as an output segment of text if the number of results generated from the search query is not equal to 0 or 1 (<parameter>!=0 && <parameter>!=1).

Dialog generation file 300 can further include random block 305, which can be configured to include a list of one or more options (e.g., Option 1, Option 2, and Option 3). Each option can include one of the functional blocks shown in FIG. 3. When executed, random block 305 can randomly select one of the options from its list and can call the functional block associated with that option. Random block 305 can then output text received from the called functional block (e.g., the output segment produced by the called functional block) as an output segment of text. If the selection of the randomly selected block is successful (e.g., successfully calls another functional block), the operation of random block 305 can end. However, if the selection of the randomly selected block fails, random block 305 can randomly select another option from the list that was not previously selected. This process can repeat until an option is successfully selected. In the event that no option is successfully selected and there are no options remaining in the list that were not previously selected, random block 305 can return an error. While random block 305 is shown having three options, it should be appreciated that random block 305 can include any number of options.

In some examples, the options of random block 305 can be assigned a weighting factor that can be used by random block 305 to increase or decrease the probability that a particular option is selected. In the absence of assigned weighting factors, the probability of selecting each option can be the same (e.g., equal weighting factors for all options).

To illustrate the operation of random block 305, Option 1 of random block 305 can include a text block 302 that includes the text “Hello,” Option 2 of random block 305 can include a text block 302 that includes the text “Hi,” and Option 3 of random block 305 can include switch block 304. Upon execution, random block 305 can randomly select one of the options (e.g., Option 2) and attempt to call the second text block 302 and output the text “Hi” returned by the second text block 302 as an output segment of text. If successful, the operation of random block 305 can end. However, if unable to output the text “Hi” as an output segment of text for any reason, random block 305 can then randomly select another option from the list that was not previously selected (e.g., select from Option 1 and Option 3). If the random selection results in a selection of Option 1, random block 305 can attempt to call the first text block 302 and output the text “Hello” returned by the first text block 302 as an output segment of text. If successful, the operation of random block 305 can end. However, if unable to output the text “Hello” as an output segment of text for any reason, random block 305 can then randomly select another option from the list that was not previously selected (e.g., select from Option 3). Since Option 3 is the only remaining option that was not previously selected, random block 305 can select Option 3 and attempt to call switch block 304. If switch block 304 is successfully executed and returns a text output, random block 305 can output the text returned from switch block 304 as an output segment of text and the operation of random block 305 can end. However, if unable to successfully call switch block 304 for any reason, random block 305 can return an error because no options were successfully selected and no options remain in the list that were not previously selected.

Dialog generation file 300 can further include opt block 306, which is an optional block that can be used to ignore any failures returned by one of its included functional blocks, such as first block 303 and random block 305. Opt block 306 can include one or more of the functional blocks shown in FIG. 3. When executed, opt block 306 can call the functional blocks contained therein and can output text received from the called functional blocks as an output segment of text. If a functional block included within opt block 306 returns an error (e.g., first block 303 or random block 305 runs out of options), opt block 306 can ignore that error to prevent the error from stopping the generation of the output dialog.

To illustrate the operation of opt block 306, opt block 306 can include first block 303, which can include Option 1 having a text block 302 that includes the text “Hello,” Option 2 having a text block 302 that includes the text “Hi,” and Option 3 having a text block 302 that includes the text “Greetings.” Upon execution, opt block 306 can call first block 303, which can first attempt to call the first text block 302 and output the text “Hello” returned by the first text block 302 as an output segment of text. If successful, first block 303 can return the text “Hello” to opt block 306, which can then output the text “Hello” as an output segment of text. However, if unable to output the text “Hello” as an output segment of text for any reason, first block 303 can then attempt to call the second text block 302 and output the text “Hi” returned by the second text block 302 as an output segment of text. If successful, first block 303 can return the text “Hi” to opt block 306, which can then output the text “Hi” as an output segment of text. However, if unable to output the text “Hi” as an output segment of text for any reason, first block 303 can then attempt to call the third text block 302 and output the text “Greetings” returned by the third text block 302 as an output segment of text. If successful, first block 303 can return the text “Greetings” to opt block 306, which can then output the text “Greetings” as an output segment of text. However, if unable to output the text “Greetings” as an output segment of text for any reason, first block 303 can return an error to opt block 306 because it reached the end of its ordered list without successfully selecting one of the three options. Opt block 306 can ignore the error and the operation of opt block 306 can end without outputting or returning an output segment of text.

Dialog generation file 300 can further include conditional block 307, which is a functional block that can include one or more of the functional blocks shown in FIG. 3 and can be executed only when a conditional statement associated with conditional block 307 is satisfied. For example, conditional block 307 can be associated with the conditional if-statement (if A==B). In this example, conditional block 307 can only be executed if A is equal to B. If A is not equal to B, conditional block 307 (and any functional blocks included within conditional block 307) may not be executed. When executed, conditional block 307 can call the functional blocks contained therein and can output text received from the called functional blocks as an output segment of text.

In some examples, the conditional statement associated with conditional block 307 can be based on information that is to be presented to the user (e.g., search query results, etc.) or contextual information, such as sensor information, information associated with the physical state of a user device, information associated with a software state of the user device, or the like. For example, the contextual information can include a type of user device used to operate the virtual assistant, an operational state of the user device, a current time, a location of the user device, an orientation of the user device, or an orientation of a user with respect to the user device.

To illustrate the operation of conditional block 307, conditional block 307 can be associated with the if-statement (if name==available) and can include a text block 302 that includes the text <name>. In this example, if the user's name is available, then conditional block 307 can be executed and can call text block 302 and output the value of <name> returned by text block 302 as an output segment of text. Alternatively, if the user's name is not available, then conditional block 307 may not be executed and no output segment of text may be generated by conditional block 307.

Typically, any output segment of text generated by text block 302, first block 303, switch block 304, random block 305, opt block 306, and conditional block 307 can be identified as being both a spoken output and a printed output (e.g., the text can be presented to the user in both audio and visual format by a user device). To cause the string of words or characters in an output segment to be only printed (e.g., only displayed to the user), dialog generation file 300 can include print only block 308. Print only block 308 can include one or more of the functional blocks shown in FIG. 3. When executed, print only block 308 can call the functional blocks contained therein and can output text returned from the called functional blocks as an output segment of text. However, unlike the other functional blocks of FIG. 3, print only block 308 can identify its output segment of text as being text that should only be printed (e.g., displayed) when presented to the user.

To illustrate the operation of print only block 308, print only block 308 can include a text block 302 that includes the text “Good afternoon.” In this example, print only block 308 can call text block 302 and output the text “Good afternoon” returned by text block 302 as an output segment of text that is identified as being only a printed output.

Similarly, to cause the string of words or characters in an output segment to be only spoken (e.g., only audibly read to the user), dialog generation file 300 can include speak only block 309. Speak only block 309 can include one or more of the functional blocks shown in FIG. 3. When executed, speak only block 309 can call the functional blocks contained therein and can output text returned from the called functional blocks as an output segment of text. However, unlike the other functional blocks of FIG. 3, speak only block 309 can identify its output segment of text as being text that should only be spoken (e.g., audibly presented) when presented to the user.

To illustrate the operation of speak only block 309, speak only block 300 can include a text block 302 that includes the text “Good afternoon.” In this example, speak only block 309 can call text block 302 and output the text “Good afternoon” returned by text block 302 as an output segment of text that is identified as being only a spoken output.

Dialog generation file 300 can further include break block 310, which represents a break function that indicates a separation in the formatting of the output dialog. For example, if the output dialog is intended to be displayed within a speech bubble, the break function of break block 310 can indicate that a new speech bubble should be created for the output segments of text following the break.

Since a dialog generation file 300 can be used to generate an output dialog for conveying a particular type of information or message to a user, multiple different dialog generation files 300 can be created to generate output dialogs that are appropriate for a variety of situations. Additionally, since dialog generation file 300 can be language-specific, a different dialog generation file 300 can be created for each language in which an output dialog is to be created.

While dialog generation file 300 is shown and described above as having functional blocks performing various functions, it should be appreciated that dialog generation file 300 can be implemented using any desired programming language. In some examples, a markup-based language, such as XML, can be used.

FIG. 4 illustrates a visual representation of an example dialog generation file 400 that can be used to generate output dialog 432 using the functional blocks 302-310 shown in FIG. 3. As shown in FIG. 4, dialog generation file 400 includes hierarchically structured functional blocks 401-414. The functional blocks are arranged in order from left to right, and functional blocks contained within other functional blocks represent functional blocks that are child functional blocks to the enclosing parent functional blocks. Additionally, functional blocks 401-414 having names matching those of the functional blocks shown in FIG. 3 can represent instances of those functional blocks.

When a call is made to dialog generation file 400 to create output dialog 432, the first block in the highest level of the hierarchy (opt block 401) can be executed. When executed, opt block 401 can call random block 402 contained therein. Random block 402 can then randomly select one of text block 403, 404, and 405 based on their associated weighting factors (e.g., weighting factors 50, 30, and 20). For example, text block 403 can have a 50% chance of being selected, text block 404 can have a 30% chance of being selected, and text block 405 can have a 20% chance of being selected. Once random block 402 randomly selects one of the text blocks, a call can be made to the selected text block. For example, if text block 405 is selected, text block 405 can be called. In response, text block 405 can return the text “Hi” to random block 402. Random block 402 can then return the text “Hi” to opt block 401. Opt block 401 can then output the text “Hi” as an output segment of text. Since opt block 401 is a functional block at the highest level of the functional block hierarchy, the output segment of text generated by opt block 401 can represent an output segment 430 of dialog generation file 400.

In some examples, the weighted random function performed by random block 402 can consider weights (some of which can be defaults) of all blocks within the random block to determine the random selection. For example, if random block 402 includes three elements having weights 2, 5, and 42, then the elements can have a probability of being selected of 2/49, 5/49, and 42/49, respectively.

Upon completion of opt block 401, execution can proceed to the next functional block in the highest level of the hierarchy (print only block 406). When executed, print only block 406 can call first block 407 contained therein. First block 407 can then select and call the functional block associated with its first option (conditional block 408). If successful, first block 407 can return the text received from conditional block 408 to print only block 406. However, if the selection of conditional block 408 fails (e.g., if the variable <user> is not available), the first block 407 can attempt to call text block 410 and output the text received from text block 410 to print only block 407. For example, if the variable <name> (representing the value “John”) is available, conditional block 408 can call text block 409. Text block 409 can return the text “, John.” to conditional block 408, which can then return the text “, John.” to print only block 406. Print only block 406 can then output the text “, John.” as an output segment of text that is identified as being a print only output. Since print only block 406 is a functional block at the highest level of the functional block hierarchy, the output segment of text generated by print only block 406 can represent an output segment 430 of dialog generation file 400.

Upon completion of print block 406, execution can proceed to the next functional block in the highest level of the hierarchy (speak only block 411). When executed, speak only block 411 can call switch block 412 contained therein. Switch block 412 can then select and call the functional block associated with one of its two options based on the value of the variable <AM/PM>. Switch block 412 can then return the text received from the called functional block to speak only block 411. For example, if the variable <AM/PM> represents the value “AM,” switch block 412 can call text block 413. Text block 413 can return the text “How are you doing this morning” to switch block 412, which can then return the text “How are you doing this morning” to speak only block 411. Speak only block 411 can then output the text “How are you doing this morning” as an output segment of text that is identified as being a speak only output. Since speak only block 411 is a functional block at the highest level of the functional block hierarchy, the output segment of text generated by speak only block 411 can represent an output segment 430 of dialog generation file 400.

Upon completion of all of the functional blocks at the highest level of the hierarchy, an output dialog 432 can be generated based on the output segments 430 of the dialog generation file 400. The output segments 430 can have an associated ordering based on the order of the functional blocks (that generated them) within dialog generation file 400. For example, the output segment containing “Hi” output by opt block 401 can be first, the output segment containing “, John.” output by print only block 406 can be second, and the output segment containing “How are you doing this morning?” output by speak only block 411 can be third. Output dialog 432 can be generated by concatenating output segments 430 in order from the first output segment to the last. Thus, output dialog 432 can include “Hi, John. How are you doing this morning?”. When presented to the user, the words “Hi, John” can be displayed to the user. The words “Hi. How are you doing this morning?” can be spoken to the user.

As illustrated by the example shown in FIG. 4, the output segments 430 used to create output dialog 432 can be created independent of each other. For example, the generation of one output segment may not depend on the generation of another segment. In other examples, one output segment 430 can be generated using a conditional statement that depends on the generation of another output segment 430.

Output Dialog Generation

FIG. 5 illustrates an exemplary process 500 that can be performed to generate an output dialog. In some examples, process 500 can be performed using a system similar or identical to system 100, shown in FIG. 1.

At block 502, an audio input including user speech can be received at a user device. In some examples, a user device (e.g., user device 102) can receive audio input that includes a user's speech via a microphone (e.g., microphone 230). The microphone can convert the audio input into an analog or digital representation, and provide the audio data to one or more processors (e.g., processor(s) 204). In some examples, the user device can transmit data representing the audio input to one or more servers, such as server system 110.

At block 504, the user speech of the audio input can be converted into a textual representation of the user speech. The user speech can be converted using any known speech-to-text conversion process. In some examples, the user speech can be converted into the textual representation locally on the user device 102. In other examples where the user device transmits data representing the audio input to one or more servers for processing, the one or more servers can receive the data representing the audio input and can instead perform the speech-to-text conversion process.

At block 506, the textual representation of user speech generated at block 504 can be received or accessed, and a response to the textual representation can be determined. The response can include information that is to be provided to the user in response to the textual representation of user speech. For example, a response to a search query can include information relating to the search query results (e.g., number of results, the actual results, etc.). The response can further include an identification of a dialog generation file that is to be used to format the output dialog to convey some or all of the information of the response to the user.

In some examples, determining the response to the textual representation can include determining a user intent based on the textual representation of user speech. As discussed in greater detail in Applicants' U.S. Utility application Ser. No. 12/987,982 for “Intelligent Automated Assistant,” filed Jan. 10, 2011, determining user intent can include analyzing, by processing modules 118, the textual representation of user speech to identify a set of syntactic or semantic parse results. The syntactic parse results can include parse results that associate data in the user input with structures that represent syntactic parts of speech, clauses, and phrases including multiword names, sentence structure, and/or other grammatical graph structures. The semantic parse results can include parse results that associate data in the user input with structures that represent concepts, relationships, properties, entities, quantities, propositions, and/or other representations of meaning and user intent. Determining user intent can further include disambiguating among alternative syntactic or semantic parse results based on the contextual representation of user speech, other user input, and/or contextual information.

Determining the response to the textual representation of user speech can further include identifying a task flow based on the determined user intent and executing the identified task flow. The task flow can include a set of steps and associated parameters to accomplish the determined user intent. In some examples, the task flow can include the step of selecting an appropriate dialog generation file for outputting the results of the task flow to the user. The dialog generation file can be selected based on the type of information that is to be provided to the user, the user's native language, other contextual information, and the like. The steps of the task flow can be executed by invoking programs, methods, services, APIs, or the like.

At block 508, a plurality of output segments can be generated based on the response determined at block 506. The output segments can include a string of one or more characters or words that can be used to generate the output dialog presented to the user. In some examples, one or more of the output segments can be generated by selecting one output from multiple possible outputs. Each output can include a string of one or more characters or words and/or a variable. For example, a first possible output for an output segment can include “Hello,” a second possible output for the output segment can include “Hi,” and a third possible output for the output segment can include “Hi,”<user>, where <user> is a variable representing the user's name. Thus, generating the output segment can include selecting one of the three possible outputs and using the selected output as the output segment.

In some examples, the dialog generation file selected at block 506 can be used to generate the plurality of output segments. The type, content, and ordering of the functional blocks within the dialog generation file can define the possible outputs for each output segment, an ordering of the output segments within the output dialog, and format for the output dialog to be displayed or otherwise presented to a user and it can be used to generate the output dialog. As discussed above with respect to FIGS. 3-4, the functional blocks at the highest level of the hierarchy in the dialog generation file (and their child functional blocks) can be executed based on their respective ordering in the file to generate the plurality of output segments.

In some examples, an output segment can be generated based on a random block of the dialog generation file to randomly select an output from multiple outputs as discussed above with respect to FIGS. 3-4. The multiple outputs can be uniformly or non-uniformly weighted using weighting factors associated with the outputs. In other examples, an output segment can also be generated based on a first block of the dialog generation file to select an output from multiple outputs based on a predetermined order of the multiple outputs as discussed above with respect to FIGS. 3-4. In yet other examples, an output segment can be generated based on a switch block of the dialog generation file to select an output from multiple outputs based on a value of an input parameter as discussed above with respect to FIGS. 3-4.

In some examples, some or all of the possible outputs for an output segment can be associated with a conditional statement of a conditional block and the output can be selected from the plurality of possible outputs based on whether or not the condition is satisfied as discussed above with respect to FIGS. 3-4. The conditional statement can depend on the information to be provided to the user determined at block 506 and/or contextual information, such as sensor information, information associated with the physical state of a user device, information associated with a software state of the user device, or the like. For example, the contextual information can include a type of user device used to operate the virtual assistant, an operational state of the user device, a current time, a location of the user device, an orientation of the user device, or an orientation of a user with respect to the user device.

In some examples, the functional blocks of the dialog generation file can further define a format for outputting the plurality of output segments to an output dialog. For example, an output segment generated from a print only block can be tagged as being an output segment that should only be displayed to a user. An output segment generated from a speak only block can be tagged as being an output segment that should only be audibly spoken to a user. Additionally, a break block can indicate that an audio and/or visual break should be included between the output segment generated from the previous functional block and the output segment generated from the subsequent output block.

In some examples, the output segments can be created independent of each other. For example, the generation of one output segment may not depend on the generation of another segment. In other examples, one output segment can be generated using a conditional statement that depends on the generation of another output segment, or a condition can be placed on a functional block included within a random block.

At block 510, an output dialog can be generated based on the plurality of segments. In some examples, generating the output dialog can include concatenating the plurality of output segments based on an order of the output segments. For example, if a first output segment includes “Hi,” a second output segment includes “,”<user>, and a third output segment includes “. How are you doing today?”, generating the output dialog based on these three output segments can include concatenating them based on their order (e.g., first, second, and third) to produce the output dialog “Hi, John. How are you doing today?”.

In some examples, as mentioned above, the output segments can be identified as being only a spoken output, only a printed output, or both a spoken and printed output. In these examples, generating the output dialog can include generating a spoken output dialog by concatenating the output segments identified as being only a spoken output, generating a printed output dialog by concatenating the output segments identified as being only a printed output, and generating a spoken and printed output dialog by concatenating the output segments identified as being both a printed and spoken output. Alternatively, a single output dialog can be generated and the words corresponding to the spoken only outputs can be tagged or otherwise identified as being only spoken, the words corresponding to the printed only outputs can be tagged or otherwise identified as being only printed, and the words corresponding to the printed and spoken outputs can be tagged or otherwise identified as being both spoken and printed.

In some examples, as mentioned above, process 500 can include tagging one or more words of the textual user input using synonyms or can include mapping a word, or a synonym for that word, to a single semantic value, and from that value to a grammatically appropriate synonym for textual output. In these examples, generating the output dialog at block 510 can include replacing an occurrence of a tagged word with the synonym or alternate word of the tag. For example, if the textual representation of user speech received at block 502 included “Forward the message to John”, the word “message” may have been tagged with the word “email.” If the plurality of output segments generated at block 508 included a first output segment “Your message has been forwarded to” and a second output segment “John”, block 510 can include concatenating the first and second segments to form the output dialog, “Your message has been forwarded to John.” Block 510 can further include replacing the word “message” with the word “email” based on the tag to form the output dialog, “Your email has been forwarded to John.” Alternatively, the word “message” can be replaced with the word “email” in the output segment prior to concatenating the segments.

In some examples, process 500 can further include transmitting the output dialog generated at block 510 to a user device. The user device can receive the output dialog and present it to the user. In some examples, the output dialog can be displayed to the user on a display of the user device and/or presented to the user in audio form. For example, as mentioned above, the output segments can be identified as being only a spoken output, only a printed output, or both a spoken and printed output. In some examples, the output dialog can be identified as being a spoken output dialog, a printed output dialog, and a spoken and printed output dialog. The spoken output dialog can be presented to the user in audio form, but not displayed. The printed output dialog can be displayed to the user, but not presented to the user in audio form. The spoken and printed output dialog can be presented to the user in audio form and displayed to the user. In other examples, a single output dialog having words tagged or otherwise identified as being only spoken, only printed, or both spoken and printed can be received. In these examples, the words tagged or otherwise identified as being only spoken can be presented to the user in audio form, but not displayed. The words tagged or identified as being only printed can be displayed to the user, but not presented in audio form. The words tagged or identified as being both spoken and printed can be presented to the user in audio form and displayed to the user.

In some examples, as mentioned above, the output dialog can include formatting information that details how the output dialog should be presented to the user. For example, an output dialog can include breaks that represent separations in the output dialog that should be displayed or otherwise conveyed to the user. For example, a break in an output dialog can indicate that a new speech bubble or other visual indication of a break in the output dialog should be created for the text following the break. FIG. 6 illustrates an exemplary conversation interface 600 between a user and a virtual assistant. As shown, a textual representation of a user's spoken input is represented by speech bubble 602. The virtual assistant's output dialog response is represented by speech bubbles 604 and 606. In this example, the output dialog provided to the user device can include “Hi, John.”<break>“How are you doing this morning?”. The <break> in the output dialog can be generated from a break block to indicate to the user device that a new speech bubble 606 should be created to display the text following the <break>. The conversation shown in conversation interface 600 can be generated from dialog generation file 400 if a break block is inserted between print only block 406 and speak only block 411.

Using process 500, an output dialog can be generated by forming and combining multiple output segments. Each output segment can be configured to be populated with one of multiple strings of characters or words to provide an output that can be dynamically generated based on the information being provided to the user and/or contextual information. Generating output dialogs in this way also obviates the need to program a virtual assistant with every candidate sentence that is to be output by the virtual assistant.

It should be appreciated that the blocks of process 500 can be performed on user device 102, server system 110, or a combination of user device 102 and server system 110. For instance, in some examples, all blocks of process 500 can be performed on user device 102. In other examples, all blocks of process 500 can be performed at server system 110. In yet other examples, some blocks of process 500 can be performed at user device 102, while other blocks of process 500 can be performed at server system 110.

Electronic Device

In accordance with some examples, FIG. 7 shows a functional block diagram of an electronic device 700 configured in accordance with the principles of the various described examples. The functional blocks of the device can be implemented by hardware, software, or a combination of hardware and software to carry out the principles of the various described examples. It is understood by persons of skill in the art that the functional blocks described in FIG. 7 can be combined or separated into sub-blocks to implement the principles of the various described examples. Therefore, the description herein optionally supports any possible combination or separation or further definition of the functional blocks described herein.

As shown in FIG. 7, electronic device 700 can include a touch screen display unit 702 configured to display a user interface and to receive touch input, and a sound receiving unit 704 configured to receive sound input. In some examples, electronic device 700 can include a speaker unit 706 configured to generate sound. Electronic device 700 can further include a processing unit 708 coupled to touch screen display unit 702 and sound receiving unit 704 (and, optionally, coupled to speaker unit 706). In some examples, processing unit 708 can include a text accessing unit 710, a response determination unit 712, an output segment generation unit 714, an output dialog generation unit 716, a tagging unit 718, an audio data receiving unit 720, a speech to text conversion unit 722, and a transmitting unit 724.

Processing unit 708 can be configured to access a textual representation of user speech (e.g., using text accessing unit 710). Processing unit 708 can be further configured to determine (e.g., using response determination unit 712) a response to the textual representation of user speech. Processing unit 708 can be further configured to generate (e.g., output segment generation unit 714) a plurality of output segments based on the determined response to the textual representation of user speech, wherein each of the plurality of output segments comprises one or more words. Processing unit 708 can be further configured to generate (e.g., output dialog generation unit 716) an output dialog based on the plurality of output segments and an order associated with the plurality of output segments.

In some examples, processing unit 708 can be configured to determine the response to the textual representation of user speech by determining (e.g., using response determination unit 712) a user intent based on the textual representation of user speech; identifying a task flow based on the determined user intent; and executing the identified task flow to determine the response to the textual representation of user speech.

In some examples, processing unit 708 can be configured to generate the plurality of output segments (e.g., using output segment generation unit 714) based on the determined response to the textual representation of user speech by selecting an output from a plurality of possible outputs for an output segment of the plurality of output segments, the selected output comprising the one or more words of the output segment.

In some examples, processing unit 708 can be configured to select (e.g., using output segment generation unit 714) the output randomly from the plurality of possible outputs.

In some examples, each of the plurality of possible outputs can be associated with a weighting factor, and wherein processing unit 708 can be configured to select (e.g., using output segment generation unit 714) the output randomly from the plurality of possible outputs based on the weighting factors.

In some examples, processing unit 708 can be configured to select (e.g., using output segment generation unit 714) the output from the plurality of possible outputs based on a predetermined order of the plurality of possible outputs.

In some examples, the plurality of possible outputs are associated with one or more conditions, and wherein processing unit 708 can be configured to select (e.g., using output segment generation unit 714) the output from the plurality of possible outputs further based on whether or not the one or more conditions are satisfied.

In some examples, the response to the textual representation of user speech can include information to be provided in response to the textual representation of user speech, and wherein the one or more conditions depend on the information to be provided in response to the textual representation of user speech. The one or more conditions can depend on contextual information. In some examples, the contextual information can include a type of user device used to operate the virtual assistant, an operational state of the user device, a current time, a location of the user device, an orientation of the user device, or an orientation of a user with respect to the user device.

In some examples, the response to the textual representation of user speech can include an identification of a dialog generation file, and wherein the dialog generation file defines: the order of the plurality of output segments; and possible outputs for each of the plurality of output segments.

In some examples, each of the possible outputs can be defined using a template, and wherein each template comprises one or more of a string of words and a variable word.

In some examples, the dialog generation file can further define a format for displaying the output dialog.

In some examples, each output segment of the plurality of output segments can be identified as being a spoken output segment or a printed output segment, and wherein processing unit 708 can be configured to generate the output dialog (e.g., using output dialog generation unit 716) by generating a spoken output dialog based on output segments identified as being a spoken output segment; and generating a printed output dialog based on output segments identified as being printed output segments.

In some examples, processing unit 708 can be configured to generate (e.g., using output segment generation unit 714) each output segment of the plurality of output independent of the other output segments.

In some examples, processing unit 708 can be configured to generate (e.g., using output dialog generation unit 716) the output dialog based on the plurality of output segments by concatenating the plurality of output segments.

In some examples, processing unit 708 can be configured to tag (e.g., using tagging unit 718), after accessing the textual representation of user speech and before determining the response to the textual representation of user speech, a word of the user speech with a dialog tag.

In some examples, the dialog tag can include a synonym of the tagged word.

In some examples, processing unit 708 can be configured to generate (e.g., using output dialog generation unit 716) the output dialog based on the plurality of output segments by replacing an occurrence of the tagged word in one or more of the plurality of output segments with the synonym of the tagged word.

In some examples, processing unit 708 can be configured to receive (e.g., using audio data receiving unit 720), before accessing the textual representation of user speech, data corresponding to an audio input comprising user speech from a user device; perform (e.g., using speech to text conversion unit 722), before accessing the textual representation of user speech, speech to text conversion on the data corresponding to the audio input to generate the textual representation of user speech; and transmit (e.g., using transmitting unit 724), after generating the output dialog, the output dialog to the user device.

As described above, one aspect of the present technology is the gathering and use of data available from various sources to improve the delivery to users of invitational content or any other content that may be of interest to them. The present disclosure contemplates that in some instances, this gathered data can include personal information data that uniquely identifies or can be used to contact or locate a specific person. Such personal information data can include demographic data, location-based data, telephone numbers, email addresses, home addresses, or any other identifying information.

The present disclosure recognizes that the use of such personal information data, in the present technology, can be used to the benefit of users. For example, the personal information data can be used to deliver targeted content that is of greater interest to the user. Accordingly, use of such personal information data enables calculated control of the delivered content. Further, other uses for personal information data that benefit the user are also contemplated by the present disclosure.

The present disclosure further contemplates that the entities responsible for the collection, analysis, disclosure, transfer, storage, or other use of such personal information data will comply with well-established privacy policies and/or privacy practices. In particular, such entities should implement and consistently use privacy policies and practices that are generally recognized as meeting or exceeding industry or governmental requirements for maintaining personal information data private and secure. For example, personal information from users should be collected for legitimate and reasonable uses of the entity and not shared or sold outside of those legitimate uses. Further, such collection should occur only after receiving the informed consent of the users. Additionally, such entities would take any needed steps for safeguarding and securing access to such personal information data and ensuring that others with access to the personal information data adhere to their privacy policies and procedures. Further, such entities can subject themselves to evaluation by third parties to certify their adherence to widely accepted privacy policies and practices.

Despite the foregoing, the present disclosure also contemplates examples in which users selectively block the use of, or access to, personal information data. That is, the present disclosure contemplates that hardware and/or software elements can be provided to prevent or block access to such personal information data. For example, in the case of advertisement delivery services, the present technology can be configured to allow users to select to “opt in” or “opt out” of participation in the collection of personal information data during registration for services. In another example, users can select not to provide location information for targeted content delivery services. In yet another example, users can select to not provide precise location information, but permit the transfer of location zone information.

Therefore, although the present disclosure broadly covers use of personal information data to implement one or more various disclosed examples, the present disclosure also contemplates that the various examples can also be implemented without the need for accessing such personal information data. That is, the various examples of the present technology are not rendered inoperable due to the lack of all or a portion of such personal information data. For example, content can be selected and delivered to users by inferring preferences based on non-personal information data or a bare minimum amount of personal information, such as the content being requested by the device associated with a user, other non-personal information available to the content delivery services, or publicly available information.

Although examples have been fully described with reference to the accompanying drawings, it is to be noted that various changes and modifications will become apparent to those skilled in the art. Such changes and modifications are to be understood as being included within the scope of the various examples as defined by the appended claims. 

What is claimed is:
 1. A method for operating a virtual assistant, performed at an electronic device having one or more processors and a memory storing one or more programs for execution by the one or more processors, the method comprising: receiving a user speech; accessing a textual representation of the user speech; determining an intent corresponding to the textual representation of the user speech; generating an output dialog responsive to the user speech, comprising: selecting, in accordance with the determined intent, a dialog template from a plurality of dialog templates, wherein the dialog template includes a plurality of sets of functional blocks, wherein a first set of functional blocks of the plurality of sets of functional blocks defines one or more conditions; generating a plurality of output segments from the plurality of sets of functional blocks, including: determining whether the one or more conditions are satisfied; and in accordance with a determination that the one or more conditions are satisfied, generating, with the first set of functional blocks, a first string for a first output segment of the plurality of output segments; and concatenating the plurality of output segments according to an order defined by the dialog template; and outputting the output dialog comprising the concatenated plurality of output segments.
 2. The method of claim 1, wherein generating an output dialog responsive to the user speech further comprises: identifying a task flow based on the determined user intent; and executing the identified task flow to generate the output dialog.
 3. The method of claim 1, wherein generating the plurality of output segments from the plurality of sets of functional blocks further comprises: selecting an output from a plurality of possible outputs for a second set of functional blocks of the plurality of sets of functional blocks, wherein an output segment of the plurality of output segments includes one or more words of the selected output.
 4. The method of claim 3, wherein the output is selected randomly from the plurality of possible outputs.
 5. The method of claim 4, wherein each of the plurality of possible outputs is associated with a weighting factor, and wherein the output is selected randomly from the plurality of possible outputs based on the weighting factors.
 6. The method of claim 3, wherein the output is selected from the plurality of possible outputs based on a predetermined order of the plurality of possible outputs.
 7. The method of claim 1, wherein generating the output dialog responsive to the user speech further comprises obtaining information in accordance with the determined intent, wherein the one or more conditions is based on the obtained information.
 8. The method of claim 1, wherein the one or more conditions depend on contextual information.
 9. The method of claim 8, wherein the contextual information comprises a type of user device used to operate the virtual assistant, an operational state of the user device, a current time, a location of the user device, an orientation of the user device, or an orientation of a user with respect to the user device.
 10. The method of claim 1, wherein each functional block of the plurality of sets of functional blocks includes a plurality of possible outputs, and wherein the plurality of possible outputs each include one or more of a string of words and a variable word.
 11. The method of claim 1, wherein the dialog template further defines a format for displaying the output dialog.
 12. The method of claim 1, wherein each output segment of the plurality of output segments is identified as being a spoken output segment or a printed output segment, and wherein outputting the output dialog comprises: outputting a spoken output dialog based on output segments identified as being a spoken output segment; and outputting a printed output dialog based on output segments identified as being printed output segments.
 13. The method of claim 1, wherein each output segment of the plurality of output segments is generated independent of the other output segments.
 14. The method of claim 1, wherein the method further comprises tagging, after accessing the textual representation of the user speech and before generating the output dialog responsive to the user speech, a word of the user speech with a dialog tag.
 15. The method of claim 14, wherein the dialog tag comprises a synonym of the tagged word.
 16. The method of claim 15, wherein generating the output dialog responsive to the user speech further comprises replacing an occurrence of the tagged word in one or more of the plurality of output segments with the synonym of the tagged word.
 17. The method of claim 1, further comprising: performing, speech to text conversion on the received user speech to generate the textual representation of the user speech.
 18. The method of claim 1, further comprising: in accordance with a determination that the one or more conditions are not satisfied, generating, with the first set of functional blocks, a second string for the first output segment of the plurality of output segments.
 19. The method of claim 1, further comprising: in accordance with a determination that the one or more conditions are not satisfied, forgo generating, with the first set of functional blocks, the first string for the first output segment of the plurality of output segments.
 20. The method of claim 1, wherein a third set of functional blocks in the plurality of sets of functional blocks includes a set of candidate output segments, and wherein generating the plurality of output segments from the plurality of sets of functional blocks further comprises: executing a first function defined in a first functional block of the third set of functional blocks to select a candidate output segment from the set of candidate output segments; and generating one of the plurality of output segments by applying, to the selected candidate output segment, a second function defined in a second functional block of the third set of functional blocks, wherein the first functional block is a child block of the second functional block.
 21. A non-transitory computer-readable storage medium comprising computer-executable instructions for: receiving a user speech; accessing a textual representation of the user speech; determining an intent corresponding to the textual representation of the user speech; generating an output dialog responsive to the user speech, comprising: selecting, in accordance with the determined intent, a dialog template from a plurality of dialog templates, wherein the dialog template includes a plurality of sets of functional blocks, wherein a first set of functional blocks of the plurality of sets of functional blocks defines one or more conditions; generating a plurality of output segments from the plurality of sets of functional blocks, including: determining whether the one or more conditions are satisfied; and in accordance with a determination that the one or more conditions are satisfied, generating, with the first set of functional blocks, a first string for a first output segment of the plurality of output segments; concatenating the plurality of output segments according to an order defined by the dialog template; and outputting the output dialog comprising the concatenated plurality of output segments.
 22. The non-transitory computer-readable storage medium of claim 21, further comprising computer executable instructions for: identifying a task flow based on the determined user intent; and executing the identified task flow.
 23. The non-transitory computer-readable storage medium of claim 21, wherein generating the plurality of output segments from the plurality of sets of functional blocks further comprises: selecting an output from a plurality of possible outputs for a second set of functional blocks of the plurality of sets of functional blocks.
 24. The non-transitory computer-readable storage medium of claim 21, wherein the output is selected randomly from the plurality of possible outputs.
 25. The non-transitory computer-readable storage medium of claim 21, further comprising computer executable instructions for: in accordance with a determination that the one or more conditions are not satisfied, generating, with the first set of functional blocks, a second string for the first output segment of the plurality of output segments.
 26. The non-transitory computer-readable storage medium of claim 21, further comprising computer executable instructions for: in accordance with a determination that the one or more conditions are not satisfied, forgo generating, with the first set of functional blocks, the first string for the first output segment of the plurality of output segments.
 27. The non-transitory computer-readable storage medium of claim 21, wherein a third set of functional blocks in the plurality of sets of functional blocks includes a set of candidate output segments, and wherein generating the plurality of output segments from the plurality of sets of functional blocks further comprises: executing a first function defined in a first functional block of the third set of functional blocks to select a candidate output segment from the set of candidate output segments; and generating one of the plurality of output segments by applying, to the selected candidate output segment, a second function defined in a second functional block of the third set of functional blocks, wherein the first functional block is a child block of the second functional block.
 28. A system comprising: one or more processors; memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for: receiving a user speech; accessing a textual representation of the user speech; determining an intent corresponding to the textual representation of the user speech; generating an output dialog responsive to the user speech, comprising: selecting, in accordance with the determined intent, a dialog template from a plurality of dialog templates, wherein the dialog template includes a plurality of sets of functional blocks, wherein a first set of functional blocks of the plurality of sets of functional blocks defines one or more conditions; generating a plurality of output segments from the plurality of sets of functional blocks, including: determining whether the one or more conditions are satisfied; and in accordance with a determination that the one or more conditions are satisfied, generating, with the first set of functional blocks, a first string for a first output segment of the plurality of output segments concatenating the plurality of output segments according to an order defined by the dialog template; and outputting the output dialog comprising the concatenated plurality of output segments.
 29. The system of claim 28, wherein the one or more programs further include instructions for: identifying a task flow based on the determined user intent; and executing the identified task flow.
 30. The system of claim 28, wherein generating the plurality of output segments from the plurality of sets of functional blocks further comprises: selecting an output from a plurality of possible outputs for a second set of functional blocks of the plurality of sets of functional blocks.
 31. The system of claim 30, wherein the output is selected randomly from the plurality of possible outputs.
 32. The system of claim 31, wherein each of the plurality of possible outputs is associated with a weighting factor, and wherein the output is selected randomly from the plurality of possible outputs based on the weighting factors.
 33. The system of claim 30, wherein the output is selected from the plurality of possible outputs based on a predetermined order of the plurality of possible outputs.
 34. The system of claim 28, wherein the one or more programs further include instructions for: in accordance with a determination that the one or more conditions are not satisfied, generating, with the first set of functional blocks, a second string for the first output segment of the plurality of output segments.
 35. The system of claim 28, wherein the one or more programs further include instructions for: in accordance with a determination that the one or more conditions are not satisfied, forgo generating, with the first set of functional blocks, the first string for the first output segment of the plurality of output segments.
 36. The system of claim 28, wherein a third set of functional blocks in the plurality of sets of functional blocks includes a set of candidate output segments, and wherein generating the plurality of output segments from the plurality of sets of functional blocks further comprises: executing a first function defined in a first functional block of the third set of functional blocks to select a candidate output segment from the set of candidate output segments; and generating one of the plurality of output segments by applying, to the selected candidate output segment, a second function defined in a second functional block of the third set of functional blocks, wherein the first functional block is a child block of the second functional block. 